<?php
declare (strict_types = 1);

namespace app\apiadmin\command;

use app\apiadmin\service\TCSS\TCSSService;
use think\console\Command;
use think\console\Input;
use think\console\Output;

class liveTools extends Command
{
    protected function configure()
    {
        // 指令配置
        $this->setName('livetools')
            ->setDescription('the livetools command');
    }

    protected function execute(Input $input, Output $output)
    {
        $task_id = "78786899";

        echo date_default_timezone_get() . PHP_EOL;

        $tcss = new TCSSService();
        //$tcss->getUrlInfo();

        // $PushUrl = $tcss->getPushUrl("test_one_live", "2024-06-11 20:08:07");
        // print_r("--------------------push url--------------------" . PHP_EOL);
        // print_r($PushUrl . PHP_EOL);

        // $test_mp4 = "https://chongchongdushu-1251993779.cos.ap-shanghai.myqcloud.com/uploads/20240507/732107e0dbd3608d4709e935d68f2fee.mp4";
        // print_r("--------------------push by file --------------------" . PHP_EOL);
        // $ret = $tcss->create_live_pull_from_mp4($test_mp4, "test_mp4", "2024-05-25 15:14:00", "2024-05-25 15:17:30", "马艳萍的测试直播间");
        // print_r($ret);
        // $ret = $tcss->modify_pull_stream_task($task_id, $test_mp4, "2024-05-25 09:50:00", "2024-05-25 23:59:59", "修正马艳萍的测试直播间");
        //print_r($ret);

        // $ret = $tcss->delete_pull_stream_task($task_id);
        // print_r($ret);

        $urls = $tcss->getPlayUrl("test_mp4", "2024-05-25 11:57:30");
        print_r("--------------------play_url--------------------" . PHP_EOL);
        print_r($urls);

        // 指令输出
        $output->writeln('livetools');
    }
}
